Skip to content

Add forward-plus lighting planner and scene integration (Statement 13) - #13

Merged
ercmine merged 1 commit into
mainfrom
codex/implement-forward-plus-lighting-path
Apr 6, 2026
Merged

Add forward-plus lighting planner and scene integration (Statement 13)#13
ercmine merged 1 commit into
mainfrom
codex/implement-forward-plus-lighting-path

Conversation

@ercmine

@ercmine ercmine commented Apr 6, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Provide an engine-owned, forward-plus style lighting planning layer to move beyond naive per-object/per-pixel loops and enable many-local-lights workflows for the stylized Perbug look.
  • Surface first-class controls for fog, bloom, directional shadow hints, emissive materials, and outline/highlight hooks in a coherent renderer-facing API.
  • Integrate lighting planning with the existing scene, submission, and shell flows so a validation scene can exercise the new data path without yet depending on full GPU pass implementations.

Description

  • Added a new lighting module engine/render/lighting.hpp + engine/render/lighting.cpp that defines input structs, GPU-packed output structs, validation helpers, LightingSelectionConfig, LightingFrameData, diagnostics, and build_forward_plus_frame_data which implements a practical forward-plus strategy (camera-relative ranking of point lights, per-view caps, per-object selection).
  • Extended the scene model in engine/scene/scene.hpp/scene.cpp with LightComponent::casts_shadows, per-renderable lighting metadata (lit, albedo_tint, emissive_color, emissive_intensity, highlighted), scene-level lighting settings (SceneLightingSettings), and collect_highlighted_renderables + lighting settings accessors.
  • Wired extraction and planning in the runtime shell engine/shell/main.cpp to build a stylized validation setup (directional + many point lights, emissive/highlighted renderables, fog/bloom settings) and call build_forward_plus_frame_data each frame to produce deterministic frame data (ready for GPU upload in follow-ups).
  • Added deterministic unit tests tests/render/lighting_pipeline_tests.cpp that validate light ranking/capping, per-object light-list limits, diagnostic counts, and settings validation; updated tests/scene/scene_tests.cpp to cover highlight/emissive plumbing; updated CMakeLists.txt and docs (docs/rendering.md, engine/render/README.md) to register tests and describe architecture and deferred work.

Testing

  • Ran repository hygiene check: git diff --check passed.
  • Added unit test target render_lighting_pipeline_tests and CTest registration for unit.renderer.lighting_pipeline; the test source tests/render/lighting_pipeline_tests.cpp performs deterministic assertions on planner behavior.
  • Attempted to configure/build with cmake --preset linux-debug, but full configure/build/test execution is blocked in this environment due to missing third-party SDK roots (SDL3/bgfx), so the new unit test has not been executed here; it is expected to succeed when the project dependencies are available.
  • Summary of validation performed: added tests compile-time integration in CMake and local git commit; functional execution of unit tests requires resolved third-party dependencies.

Codex Task

@ercmine
ercmine merged commit dd524ab into main Apr 6, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant